package API.Collection.Traversal;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class IteratorAPI {
    public static void main(String[] args) {
        Collection<Integer> list = new ArrayList<>();
        for(int i = 1; i <= 10; i++) {
            list.add(i);
        }
        Iterator<Integer> iterator = list.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next());
        }
    }
}
